<!DOCTYPE html>
<html>
<head>
    <meta charset="UTF-8">
    <title> {$action} | {:get_opinion('title')}</title>

    <include file="Public:head"/>

</head>
<body class="skin-blue">

{:W('Common/header')}

<div class="wrapper row-offcanvas row-offcanvas-left">
    {:W('Common/sideMenu')}


    <!-- Right side column. Contains the navbar and content of the page -->
    <aside class="right-side">
        <!-- Content Header (Page header) -->


        <section class="content-header">
            <h1>
                {$action}
                <small>{:get_opinion('title')}</small>
            </h1>
            <ol class="breadcrumb">
                <li><a href="{$module_url}"><i class="fa fa-dashboard"></i> {$module}</a></li>
                <li class="active">{$action}</li>
            </ol>
        </section>

        <!-- Main content -->
        <section class="content">

            <div class="row">
                <div class="col-md-12">

                        <!-- /.box-header -->
                        <div class="box-body">

                            <div class="col-md-3">
                                <div class="btn-group">
                                    <a href="{:U('Admin/Access/addrole')}">
                                        <button id="sample_editable_1_new" class="btn btn-success">
                                            <i class="icon-plus"></i>添加角色
                                        </button>
                                    </a>
                                </div>
                            </div>

                        <span class="control-group success"
                              style="font-size:16px;color: red;text-align: left; display:none;"></span>
                            </h4>
                            <!-- BEGIN EXAMPLE TABLE PORTLET-->

                            <table class="table table-striped table-bordered table-hover">
                                <thead>
                                <tr>
                                    <td>序号</td>
                                    <td>组ID</td>
                                    <td>组名</td>
                                    <td>描述</td>
                                    <td>状态</td>
                                    <td>操作</td>
                                </tr>
                                </thead>
                                <volist name="rolelist" id="vo" key="k">
                                    <tr align="center" id="{$vo.id}">
                                        <td>{$k}</td>
                                        <td>{$vo.id}</td>
                                        <td>{$vo.name}</td>
                                        <td align="left">{$vo.remark}</td>
                                        <td>{$vo.statusTxt}</td>
                                        <td>
                                            <if condition="$vo.pid eq 0">
                                                <else/>
                                                [ <a href="javascript:void(0);" class="opStatus" val="{$vo.status}">{$vo.chStatusTxt}</a>]
                                                [ <a href="{:U('Admin/Access/editRole',array('id'=>$vo['id']))}"
                                                     class="edit">编辑</a> ]
                                                [ <a href="{:U('Admin/Access/changeRole',array('id'=>$vo['id']))}"
                                                     class="edit">权限分配</a> ]
                                                [ <a href="{:U('Admin/Access/setrolecat',array('id'=>$vo['id']))}"
                                                     class="edit">投稿分类</a> ]


                                            </if>
                                        </td>
                                    </tr>
                                </volist>
                            </table>


                        </div>
                    </div>
                </div>

        </section>
        <!-- /.content -->
    </aside>
    <!-- /.right-side -->
</div>
<!-- ./wrapper -->

<include file="Public:foot"/>
<script>
    jQuery(document).ready(function () {

        //快捷启用禁用操作
        $(".opStatus").click(function () {
            var obj = $(this);
            var id = $(this).parents("tr").attr("id");
            var status = $(this).attr("val");
            var div = $(".success");
            var url = "{:U('Admin/Access/opRoleStatus')}";
            $.getJSON(url, {id: id, status: status}, function (json) {
                if (json.status == 1) {
                    div.fadeIn().html(json.info);
                    div.fadeOut(3000);
                    $(obj).attr("val", json.data.status).html(status == 1 ? "启用" : "禁用").parents("td").prev().html(status == 1 ? "禁用" : "启用");
                } else {
                    div.fadeIn().html(json.info);
                    div.fadeOut(3000);
                }
            });
        });
    });
</script>
</body>
</html>